﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;


using OneStop.Calculations;

namespace OneStop.UI
{
    public partial class GasAdmin : ChildWindow
    {
        MainProvider Provider;        

        public GasAdmin(MainProvider provider)
        {
            InitializeComponent();

            this.Provider = provider;

            GasList.ItemsSource = provider.ProfilePrimary.Gases;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }

        private void ChildWindow_Loaded(object sender, RoutedEventArgs e)
        {            
//            GasList.ItemsSource = Provider.Gases;
            //GasList.ItemsSource = g;

            //Provider.Gases[0].FO2 = 0.5;

            
            GasList.SelectedIndex = 0;

            //this.Resources.Add("SelectedGas", GasList.SelectedItem);
        }

        private void GasList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Details.DataContext = GasList.SelectedItem;
        }

        private void AddGas_Click(object sender, RoutedEventArgs e)
        {
            Provider.ProfilePrimary.Gases.Add(new Gas());
        }
    }
}

